package com.jd.sunny.java.collection;

import java.util.Comparator;
import java.util.TreeSet;

/**
 * @Description: red and black tree
 * @author:sunlin
 * @since:2012-12-05 18:16
 * @version:1.0.0
 */
public class TestTreeSet {

    public static void main(String[]args){
        //we can new a object to use
        ItemComparator itemComparator = new ItemComparator();
        TreeSet<Item> itemTreeSet = new TreeSet<Item>(itemComparator) ;

        //we can also use anonymos inner class
        TreeSet<Item> items = new TreeSet<Item>(new Comparator<Item>() {
            public int compare(Item o1, Item o2) {
                return o1.getName().compareTo(o2.getName());
            }
        });
        
    }

}
